/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package repol190.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author micael
 */
public class ConexaoBD {
    
    private final String DATABASE_URL = "jdbc:postgresql://localhost:5432/repol";
    private final String JDBC_DRIVER = "org.postgresql.Driver";
    private final String USER = "postgres";
    private final String PASSWORD = "postgres123";
    private Connection con = null; //gerencia conexao
   // public PreparedStatement comando = null;


    public Connection abrirConexao(/*String sql*/) {

        try {

            Class.forName(JDBC_DRIVER);

            con = DriverManager.getConnection(DATABASE_URL, USER, PASSWORD);


           // comando = con.prepareStatement(sql);

        } catch (java.lang.ClassNotFoundException e) {

            System.err.print("ClassNotFoundException: ");

            System.err.println(e.getMessage());

        } catch (SQLException ex) {

            System.err.print("SQLException: ");

            System.err.println(ex.getMessage());
        }

        return con;

    }
    
}
